<!DOCTYPE html>



  


<html class="theme-next pisces use-motion" lang="zh-Hans">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<meta name="theme-color" content="#222">









<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
















  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />







<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.1.4" rel="stylesheet" type="text/css" />


  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png?v=5.1.4">


  <link rel="mask-icon" href="/images/logo.svg?v=5.1.4" color="#222">





  <meta name="keywords" content="笔记,ctf,xman,pwn,栈溢出,堆利用," />





  <link rel="alternate" href="/atom.xml" title="Mugen" type="application/atom+xml" />






<meta name="description" content="上课笔记 系统调用 有独特的调用约定 32：eax-syscall号，ebx,ecx,ed 64:   gdbinfo b 查看断点/ pwntools  小功能： cyclic pattern(cyclic()),cyclic_find()) 小功能： fmtstr_payload  格式化字符串可变参数101：    C语言可变用参数用…表示 可以接受任意长度参数 va_list:va_sta">
<meta name="keywords" content="笔记,ctf,xman,pwn,栈溢出,堆利用">
<meta property="og:type" content="article">
<meta property="og:title" content="xman-pwn">
<meta property="og:url" content="http://legoc.gitee.io/2018/08/05/xman-pwn/index.html">
<meta property="og:site_name" content="Mugen">
<meta property="og:description" content="上课笔记 系统调用 有独特的调用约定 32：eax-syscall号，ebx,ecx,ed 64:   gdbinfo b 查看断点/ pwntools  小功能： cyclic pattern(cyclic()),cyclic_find()) 小功能： fmtstr_payload  格式化字符串可变参数101：    C语言可变用参数用…表示 可以接受任意长度参数 va_list:va_sta">
<meta property="og:locale" content="zh-Hans">
<meta property="og:image" content="http://oayoilchh.bkt.clouddn.com/17-3-18/35031846-file_1489776459315_10751.png">
<meta property="og:image" content="http://oayoilchh.bkt.clouddn.com/17-3-18/95379439-file_1489777462726_1270b.png">
<meta property="og:updated_time" content="2018-08-09T07:48:17.152Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="xman-pwn">
<meta name="twitter:description" content="上课笔记 系统调用 有独特的调用约定 32：eax-syscall号，ebx,ecx,ed 64:   gdbinfo b 查看断点/ pwntools  小功能： cyclic pattern(cyclic()),cyclic_find()) 小功能： fmtstr_payload  格式化字符串可变参数101：    C语言可变用参数用…表示 可以接受任意长度参数 va_list:va_sta">
<meta name="twitter:image" content="http://oayoilchh.bkt.clouddn.com/17-3-18/35031846-file_1489776459315_10751.png">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Pisces',
    version: '5.1.4',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":true,"scrollpercent":true,"onmobile":false},
    fancybox: true,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="http://legoc.gitee.io/2018/08/05/xman-pwn/"/>





  <title>xman-pwn | Mugen</title>
  








</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/"  class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">Mugen</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle">lego's blog</p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br />
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
            
            归档
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
            
            标签
          </a>
        </li>
      
        
        <li class="menu-item menu-item-links">
          <a href="/links" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-flag"></i> <br />
            
            朋友
          </a>
        </li>
      
        
        <li class="menu-item menu-item-about">
          <a href="/about/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-user"></i> <br />
            
            关于我
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="http://legoc.gitee.io/2018/08/05/xman-pwn/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="lego">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="https://raw.githubusercontent.com/legoc/legoc.github.io/master/about/index/baye.png">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Mugen">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">xman-pwn</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2018-08-05T19:37:52+08:00">
                2018-08-05
              </time>
            

            

            
          </span>

          
            <span class="post-category" >
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/CTF/" itemprop="url" rel="index">
                    <span itemprop="name">CTF</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
          

          
          

          
            <span class="post-meta-divider">|</span>
            <span class="page-pv"><i class="fa fa-file-o"></i> 阅读次数
            <span class="busuanzi-value" id="busuanzi_value_page_pv" ></span>
            </span>
          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <h1 id="上课笔记"><a href="#上课笔记" class="headerlink" title="上课笔记"></a>上课笔记</h1><ul>
<li>系统调用</li>
<li>有独特的调用约定</li>
<li>32：eax-syscall号，ebx,ecx,ed</li>
<li>64: </li>
</ul>
<p>gdb<br>info b 查看断点/</p>
<p>pwntools</p>
<ul>
<li>小功能： cyclic pattern(cyclic()),cyclic_find())</li>
<li>小功能： fmtstr_payload</li>
</ul>
<p>格式化字符串<br>可变参数101：  </p>
<ul>
<li>C语言可变用参数用…表示</li>
<li>可以接受任意长度参数</li>
<li>va_list:va_start,va_end,va_rag</li>
</ul>
<hr>
<h1 id="基础栈溢出复习之基础"><a href="#基础栈溢出复习之基础" class="headerlink" title="基础栈溢出复习之基础"></a>基础栈溢出复习之基础</h1><p>参考（抄）自swing大佬的文章（逃</p>
<p>栈与系统栈</p>
<p>栈：一种先进先出的数据结构。常见的操作有两种，进栈（PUSH）和弹栈（POP）。</p>
<p>程序中的栈：</p>
<ul>
<li><p>内存中的一块区域，采用栈的结构来管理，高地址向低地址增长</p>
</li>
<li><p>寄存器esp代表栈顶（最低栈地址）</p>
</li>
<li><p>栈操作</p>
<ul>
<li><p>压栈（入栈）push sth-&gt; [esp]=sth,esp=esp-4</p>
</li>
<li><p>弹栈（出栈）pop sth-&gt; sth=[esp],esp=esp+4</p>
</li>
</ul>
</li>
<li><p>栈用于保存函数调用信息和局部变量函数调用如何通过系统栈进行函数的调用与递归</p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line"><span class="function"><span class="keyword">int</span> <span class="title">fun_b</span><span class="params">(x,y)</span></span>&#123;</span><br><span class="line">    <span class="keyword">int</span> var_b1,var_b2;</span><br><span class="line"></span><br><span class="line">    rutrun var_b1 * var_b2 ;</span><br><span class="line">&#125;</span><br><span class="line"><span class="function"><span class="keyword">int</span> <span class="title">fun_a</span><span class="params">(a,b)</span></span>&#123;</span><br><span class="line">    <span class="keyword">int</span> var_a;</span><br><span class="line">    var_a = fun_b(a*b)</span><br><span class="line">    </span><br><span class="line">&#125;</span><br><span class="line"><span class="keyword">int</span> main(<span class="keyword">int</span> argc,chr **argv,chr **envp)</span><br><span class="line">&#123;</span><br><span class="line">    <span class="keyword">int</span> var_main;</span><br><span class="line">    var_main = func_a&#123;<span class="number">5</span>,<span class="number">5</span>&#125;;</span><br><span class="line">    rutrun var_main;</span><br><span class="line"></span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>函数的分布应当是: </p>
<p><img src="http://oayoilchh.bkt.clouddn.com/17-3-18/35031846-file_1489776459315_10751.png" alt="img"> </p>
</li>
</ul>
<p>函数调用指令：call ret</p>
<p>大致过程:</p>
<ul>
<li>参数入栈</li>
<li>返回地址入栈</li>
<li>代码区块跳转</li>
<li>栈帧调整:<br>  保存当前栈帧的状态值，为了后面恢复本栈帧时使用(EBP入栈)；<br>  将当前的栈帧切换到新栈帧(ESP值装入EBP，更新栈帧底部)<br>  给新栈帧分配空间(ESP减去所需要空间的大小，抬高栈顶)<br>  相关指令:</li>
<li>Call func -&gt; push pc, jmp func</li>
<li>Leave -&gt;mov esp,ebp, pop ebp </li>
<li>Ret -&gt; pop pc</li>
</ul>
<p>函数约定:</p>
<ul>
<li><p><strong>stdcall，</strong>cdecl，<strong>fastcall，</strong>thiscall，<strong>nakedcall，</strong>pascal<br>以 __fastcall为例子:</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">push  参数 3               #参数由右向左入栈</span><br><span class="line">push 参数 2</span><br><span class="line">push 参数 1</span><br><span class="line">call 函数地址    #push当前指令位置，跳转到所调用函数的入口地址</span><br><span class="line"></span><br><span class="line">push ebp         #保存旧栈帧的底部</span><br><span class="line">mov ebp,esp    #设置新栈帧底部</span><br><span class="line">sub esp ,xxx      #设置新栈帧顶部</span><br></pre></td></tr></table></figure>
</li>
</ul>
<p>参数传参:取决于调用约定，一般情况下:</p>
<ul>
<li>X86 从右向左入栈，X64 优先寄存器，参数过多时才入栈</li>
</ul>
<p>寄存器<br>重要的寄存器：rsp/esp, pc, rbp/ebp, rax/eax, rdi, rsi, rdx, rcx<br>ESP: 栈指针寄存器，内存存放着一个指针，指针指向系统栈最上面一个栈帧的底部<br>EBP:基址指针寄存器，存放着一个指针，指针指向系统栈最上面的一个栈帧底部</p>
<p><img src="http://oayoilchh.bkt.clouddn.com/17-3-18/95379439-file_1489777462726_1270b.png" alt="img"> </p>
<p>堆栈溢出原理 </p>
<p>通俗的讲，栈溢出的原理就是不顾堆栈中分配的局部数据块大小，向该数据快写入了过多的数据，导致数据越界，结果覆盖来看老的堆栈数据。</p>
<p>栈溢出的保护机制栈上的数据无法被当作指令来执行</p>
<ul>
<li>数据执行保护(NX/DEP)</li>
<li>绕过方法ROP难以找到想要找的地址</li>
<li>地址空间布局随机化(ASLR)</li>
<li>绕过方法:infoleak 、retdlresolve 、ROP检测栈数据是否被修改</li>
<li>Stack Canary/ Cookie</li>
<li>绕过方法: infoleak</li>
</ul>
<h1 id="堆溢出"><a href="#堆溢出" class="headerlink" title="堆溢出"></a>堆溢出</h1><ul>
<li><p>修改下一个堆块的size，标志位，fd/bk指针等</p>
</li>
<li><p>修改下一个堆块的用户数据</p>
</li>
</ul>
<h2 id="Use-after-free"><a href="#Use-after-free" class="headerlink" title="Use after free"></a>Use after free</h2><ul>
<li>释放后指针没有被置为NULL</li>
</ul>
<h2 id="Unlink"><a href="#Unlink" class="headerlink" title="Unlink"></a>Unlink</h2><ul>
<li>控制堆块的fd和bk指针</li>
</ul>
<h2 id="Off-by-one"><a href="#Off-by-one" class="headerlink" title="Off by one"></a>Off by one</h2><ul>
<li>只能溢出一个字</li>
<li>改写下一个块size</li>
</ul>
<h3 id="例子-note"><a href="#例子-note" class="headerlink" title="例子 note"></a>例子 note</h3><h2 id="Fast-bin-attack"><a href="#Fast-bin-attack" class="headerlink" title="Fast bin attack"></a>Fast bin attack</h2><ul>
<li>ctf中常用的攻击手法</li>
<li>关键点：控制fd指针</li>
<li>UAF:directly corrupted fd</li>
<li>Double free: fast bin dup</li>
</ul>
<h2 id="Unsorted-bin-attack"><a href="#Unsorted-bin-attack" class="headerlink" title="Unsorted bin attack"></a>Unsorted bin attack</h2><ul>
<li>ctf中第二常见的手法</li>
<li>任意地址写固定值</li>
<li>关键点：控制bk指针，bk=addr-0x10(64bit)</li>
<li>Malloc一个大小正好的堆块</li>
<li>最终达到效果addr=main_arena+0x58</li>
<li>通常改写global_max，fast</li>
</ul>
<h2 id="House-of-xxx"><a href="#House-of-xxx" class="headerlink" title="House of xxx"></a>House of xxx</h2><h3 id="House-of-Spirit"><a href="#House-of-Spirit" class="headerlink" title="House of Spirit"></a>House of Spirit</h3><ul>
<li>本质是fast bin attack</li>
<li>fake a fast bin chunk</li>
<li>改写fast bin chunk的fb指针，让其指向fake chunk</li>
<li>Malloc两次</li>
</ul>
<h3 id="Host-of-Force"><a href="#Host-of-Force" class="headerlink" title="Host of Force"></a>Host of Force</h3><ul>
<li>When use top chunk to malloc</li>
</ul>
<h3 id="Host-of-Orange"><a href="#Host-of-Orange" class="headerlink" title="Host of Orange"></a>Host of Orange</h3><ul>
<li>在没有free函数的情况下获得一个unsorted bin?</li>
<li>伪造top chunk size的几个条件<ul>
<li>伪造的size必须要对齐到内存页</li>
<li>Size要大于MINSIZE(0x10)</li>
<li>Size要小于之后申请的chunk size+MINSIZE(0x10)</li>
<li>Size的prev inuse位必须为1</li>
</ul>
</li>
</ul>
<h3 id="House-of-Roman"><a href="#House-of-Roman" class="headerlink" title="House of Roman"></a>House of Roman</h3><ul>
<li>Fast bin attack + unsorted bin attack</li>
<li>没有泄露</li>
<li>Partial write to bypass ASLR</li>
</ul>
<h1 id="IO-FILE"><a href="#IO-FILE" class="headerlink" title="_IO_FILE"></a>_IO_FILE</h1><h2 id="FILE介绍"><a href="#FILE介绍" class="headerlink" title="FILE介绍"></a>FILE介绍</h2><p>FILE在Linux系统的标准IO库中用于描述文件的结构，称为文件流。我们常定义一个指向FILE结构的指针来接收这个返回值。</p>
<p>FILE结构定义在libio.h中,如下所示</p>
<figure class="highlight c"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br></pre></td><td class="code"><pre><span class="line"><span class="class"><span class="keyword">struct</span> _<span class="title">IO_FILE</span> &#123;</span></span><br><span class="line">  <span class="keyword">int</span> _flags;       <span class="comment">/* High-order word is _IO_MAGIC; rest is flags. */</span></span><br><span class="line"><span class="meta">#<span class="meta-keyword">define</span> _IO_file_flags _flags</span></span><br><span class="line"></span><br><span class="line">  <span class="comment">/* The following pointers correspond to the C++ streambuf protocol. */</span></span><br><span class="line">  <span class="comment">/* <span class="doctag">Note:</span>  Tk uses the _IO_read_ptr and _IO_read_end fields directly. */</span></span><br><span class="line">  <span class="keyword">char</span>* _IO_read_ptr;   <span class="comment">/* Current read pointer */</span></span><br><span class="line">  <span class="keyword">char</span>* _IO_read_end;   <span class="comment">/* End of get area. */</span></span><br><span class="line">  <span class="keyword">char</span>* _IO_read_base;  <span class="comment">/* Start of putback+get area. */</span></span><br><span class="line">  <span class="keyword">char</span>* _IO_write_base; <span class="comment">/* Start of put area. */</span></span><br><span class="line">  <span class="keyword">char</span>* _IO_write_ptr;  <span class="comment">/* Current put pointer. */</span></span><br><span class="line">  <span class="keyword">char</span>* _IO_write_end;  <span class="comment">/* End of put area. */</span></span><br><span class="line">  <span class="keyword">char</span>* _IO_buf_base;   <span class="comment">/* Start of reserve area. */</span></span><br><span class="line">  <span class="keyword">char</span>* _IO_buf_end;    <span class="comment">/* End of reserve area. */</span></span><br><span class="line">  <span class="comment">/* The following fields are used to support backing up and undo. */</span></span><br><span class="line">  <span class="keyword">char</span> *_IO_save_base; <span class="comment">/* Pointer to start of non-current get area. */</span></span><br><span class="line">  <span class="keyword">char</span> *_IO_backup_base;  <span class="comment">/* Pointer to first valid character of backup area */</span></span><br><span class="line">  <span class="keyword">char</span> *_IO_save_end; <span class="comment">/* Pointer to end of non-current get area. */</span></span><br><span class="line"></span><br><span class="line">  <span class="class"><span class="keyword">struct</span> _<span class="title">IO_marker</span> *_<span class="title">markers</span>;</span></span><br><span class="line"></span><br><span class="line">  <span class="class"><span class="keyword">struct</span> _<span class="title">IO_FILE</span> *_<span class="title">chain</span>;</span></span><br><span class="line"></span><br><span class="line">  <span class="keyword">int</span> _fileno;</span><br><span class="line"><span class="meta">#<span class="meta-keyword">if</span> 0</span></span><br><span class="line">  <span class="keyword">int</span> _blksize;</span><br><span class="line"><span class="meta">#<span class="meta-keyword">else</span></span></span><br><span class="line">  <span class="keyword">int</span> _flags2;</span><br><span class="line"><span class="meta">#<span class="meta-keyword">endif</span></span></span><br><span class="line">  _IO_off_t _old_offset; <span class="comment">/* This used to be _offset but it's too small.  */</span></span><br><span class="line"></span><br><span class="line"><span class="meta">#<span class="meta-keyword">define</span> __HAVE_COLUMN <span class="comment">/* temporary */</span></span></span><br><span class="line">  <span class="comment">/* 1+column number of pbase(); 0 is unknown. */</span></span><br><span class="line">  <span class="keyword">unsigned</span> <span class="keyword">short</span> _cur_column;</span><br><span class="line">  <span class="keyword">signed</span> <span class="keyword">char</span> _vtable_offset;</span><br><span class="line">  <span class="keyword">char</span> _shortbuf[<span class="number">1</span>];</span><br><span class="line"></span><br><span class="line">  <span class="comment">/*  char* _save_gptr;  char* _save_egptr; */</span></span><br><span class="line"></span><br><span class="line">  _IO_lock_t *_lock;</span><br><span class="line"><span class="meta">#<span class="meta-keyword">ifdef</span> _IO_USE_OLD_IO_FILE</span></span><br><span class="line">&#125;;</span><br></pre></td></tr></table></figure>
<h1 id="Windows"><a href="#Windows" class="headerlink" title="Windows"></a>Windows</h1><h2 id="Tools"><a href="#Tools" class="headerlink" title="Tools"></a>Tools</h2><ul>
<li>ida pro</li>
<li>x64 DBG</li>
<li>winDBG</li>
<li>Mona</li>
</ul>
<h2 id="real-world"><a href="#real-world" class="headerlink" title="real world"></a>real world</h2><ul>
<li>cve-2017-11882</li>
</ul>
<h1 id="漏洞挖掘"><a href="#漏洞挖掘" class="headerlink" title="漏洞挖掘"></a>漏洞挖掘</h1><h2 id="Code-AUDIT"><a href="#Code-AUDIT" class="headerlink" title="Code AUDIT"></a>Code AUDIT</h2><ul>
<li>open source</li>
<li>从整体出发，关键模块重点关注</li>
<li>丰富的coding经验</li>
</ul>
<h2 id="RVERSE"><a href="#RVERSE" class="headerlink" title="RVERSE"></a>RVERSE</h2><ul>
<li>静态分析<ul>
<li>汇编代码</li>
<li>伪代码审计</li>
</ul>
</li>
<li>动态分析</li>
</ul>
<h2 id="FUZZING"><a href="#FUZZING" class="headerlink" title="FUZZING"></a>FUZZING</h2><ul>
<li>Automated or semi-automated</li>
<li>高回报</li>
</ul>
<h2 id="TARGET"><a href="#TARGET" class="headerlink" title="TARGET"></a>TARGET</h2><ul>
<li>越界数组</li>
<li>缓冲区溢出</li>
<li>格式化字符串漏洞</li>
<li>整型溢出</li>
<li>指针操作不当</li>
<li>条件竞争</li>
<li>类型混淆</li>
</ul>
<hr>
<p></p><p align="right">再也不去奢求什么未来 </p><p></p>

      
    </div>
    
    
    

    

    

    
      <div>
        <ul class="post-copyright">
  <li class="post-copyright-author">
    <strong>本文作者：</strong>
    lego
  </li>
  <li class="post-copyright-link">
    <strong>本文链接：</strong>
    <a href="http://legoc.gitee.io/2018/08/05/xman-pwn/" title="xman-pwn">http://legoc.gitee.io/2018/08/05/xman-pwn/</a>
  </li>
  <li class="post-copyright-license">
    <strong>版权声明： </strong>
    本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" rel="external nofollow" target="_blank">CC BY-NC-SA 4.0</a> 许可协议。转载请注明出处！
  </li>
</ul>

      </div>
    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/笔记/" rel="tag"># 笔记</a>
          
            <a href="/tags/ctf/" rel="tag"># ctf</a>
          
            <a href="/tags/xman/" rel="tag"># xman</a>
          
            <a href="/tags/pwn/" rel="tag"># pwn</a>
          
            <a href="/tags/栈溢出/" rel="tag"># 栈溢出</a>
          
            <a href="/tags/堆利用/" rel="tag"># 堆利用</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2018/08/02/xman-re/" rel="next" title="xman-re">
                <i class="fa fa-chevron-left"></i> xman-re
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2018/08/11/一个弱口令引发的惨案/" rel="prev" title="一个弱口令引发的惨案">
                一个弱口令引发的惨案 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          

  
 <div id="gitalk-container"></div>
 
  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <img class="site-author-image" itemprop="image"
                src="https://raw.githubusercontent.com/legoc/legoc.github.io/master/about/index/baye.png"
                alt="lego" />
            
              <p class="site-author-name" itemprop="name">lego</p>
              <p class="site-description motion-element" itemprop="description">从小菜鸡往大菜鸡成长的路上...</p>
          </div>

          <nav class="site-state motion-element">

            
              <div class="site-state-item site-state-posts">
              
                <a href="/archives/">
              
                  <span class="site-state-item-count">41</span>
                  <span class="site-state-item-name">日志</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-categories">
                <a href="/categories/index.html">
                  <span class="site-state-item-count">8</span>
                  <span class="site-state-item-name">分类</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-tags">
                <a href="/tags/index.html">
                  <span class="site-state-item-count">63</span>
                  <span class="site-state-item-name">标签</span>
                </a>
              </div>
            

          </nav>

          
            <div class="feed-link motion-element">
              <a href="/atom.xml" rel="alternate">
                <i class="fa fa-rss"></i>
                RSS
              </a>
            </div>
          

          

          
          

          
          

          

        </div>
      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#上课笔记"><span class="nav-number">1.</span> <span class="nav-text">上课笔记</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#基础栈溢出复习之基础"><span class="nav-number">2.</span> <span class="nav-text">基础栈溢出复习之基础</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#堆溢出"><span class="nav-number">3.</span> <span class="nav-text">堆溢出</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#Use-after-free"><span class="nav-number">3.1.</span> <span class="nav-text">Use after free</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Unlink"><span class="nav-number">3.2.</span> <span class="nav-text">Unlink</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Off-by-one"><span class="nav-number">3.3.</span> <span class="nav-text">Off by one</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#例子-note"><span class="nav-number">3.3.1.</span> <span class="nav-text">例子 note</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Fast-bin-attack"><span class="nav-number">3.4.</span> <span class="nav-text">Fast bin attack</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Unsorted-bin-attack"><span class="nav-number">3.5.</span> <span class="nav-text">Unsorted bin attack</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#House-of-xxx"><span class="nav-number">3.6.</span> <span class="nav-text">House of xxx</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#House-of-Spirit"><span class="nav-number">3.6.1.</span> <span class="nav-text">House of Spirit</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#Host-of-Force"><span class="nav-number">3.6.2.</span> <span class="nav-text">Host of Force</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#Host-of-Orange"><span class="nav-number">3.6.3.</span> <span class="nav-text">Host of Orange</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#House-of-Roman"><span class="nav-number">3.6.4.</span> <span class="nav-text">House of Roman</span></a></li></ol></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#IO-FILE"><span class="nav-number">4.</span> <span class="nav-text">_IO_FILE</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#FILE介绍"><span class="nav-number">4.1.</span> <span class="nav-text">FILE介绍</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#Windows"><span class="nav-number">5.</span> <span class="nav-text">Windows</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#Tools"><span class="nav-number">5.1.</span> <span class="nav-text">Tools</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#real-world"><span class="nav-number">5.2.</span> <span class="nav-text">real world</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#漏洞挖掘"><span class="nav-number">6.</span> <span class="nav-text">漏洞挖掘</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#Code-AUDIT"><span class="nav-number">6.1.</span> <span class="nav-text">Code AUDIT</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#RVERSE"><span class="nav-number">6.2.</span> <span class="nav-text">RVERSE</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#FUZZING"><span class="nav-number">6.3.</span> <span class="nav-text">FUZZING</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#TARGET"><span class="nav-number">6.4.</span> <span class="nav-text">TARGET</span></a></li></ol></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      
        <div class="back-to-top">
          <i class="fa fa-arrow-up"></i>
          
            <span id="scrollpercent"><span>0</span>%</span>
          
        </div>
      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; <span itemprop="copyrightYear">2023</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">lego</span>

  
</div>


  <div class="powered-by">由 <a class="theme-link" target="_blank" href="https://hexo.io">Hexo</a> 强力驱动</div>



  <span class="post-meta-divider">|</span>



  <div class="theme-info">主题 &mdash; <a class="theme-link" target="_blank" href="https://github.com/iissnan/hexo-theme-next">NexT.Pisces</div>




        
<div class="busuanzi-count">
  <script async src="https://dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js"></script>

  

  
</div>








        
      </div>
    </footer>

    

    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  












  
  
    <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>
  

  
  
    <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
  


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.4"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.4"></script>



  
  


  <script type="text/javascript" src="/js/src/affix.js?v=5.1.4"></script>

  <script type="text/javascript" src="/js/src/schemes/pisces.js?v=5.1.4"></script>



  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.4"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.4"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.4"></script>



  


  




	





  





  












  <link rel="stylesheet" href="https://unpkg.com/gitalk/dist/gitalk.css">
  <script src="https://unpkg.com/gitalk/dist/gitalk.min.js"></script>
   <script type="text/javascript">
        var gitalk = new Gitalk({
          clientID: '76aae4c57ee7f811d638',
          clientSecret: 'd6d32a0bf34087bf9ee31a1a74fd5bd72cc23c92',
          repo: 'legoc.github.io',
          owner: 'legoc',
          admin: ['legoc'],
          id: decodeURI(window.location.pathname),
          distractionFreeMode: 'true'
        })
        gitalk.render('gitalk-container')           
       </script>
	   
	   
	   




  





  

  

  

  
  

  

  

  

</body>
</html>
